﻿using System; 
using System.Collections.Generic;
using HAVNet.Core.String;
using HAVNet.Intros.Parsing;


namespace HAVNet.Intros.AST
{
    public class ASTMemberDeclConst : ASTMemberDeclStruct
    {
        List<ASTConstInitializer> _initializers = null;

        public ASTType type { get; set; }
        public List<ASTConstInitializer> initializers { get { if (null == _initializers) _initializers = new List<ASTConstInitializer>(); return _initializers; } }

        public override string ToString ()
        {
            string mods = "";

            if (Mods.has(modifiers, Mods.publicMod      )) mods += "public ";
            if (Mods.has(modifiers, Mods.privateMod     )) mods += "private ";
            if (Mods.has(modifiers, Mods.internalMod    )) mods += "internal ";
            if (Mods.has(modifiers, Mods.protectedMod   )) mods += "protected ";
            if (Mods.has(modifiers, Mods.newMod         )) mods += "new ";

            return
                mods +
                "const " +
                type.ToString() + " " +
                Strings.joinobjs(", ", initializers) +
                ";";
        }
    }
}
